package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.Menu;
import com.sc.nft.mapper.MenuMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 系统菜单表(pro_menu)数据DAO
 *
 * @author zhangxiangyu
 * @since 2022-02-02 17:11:19
 * @description 
 */
@Slf4j
@Repository
public class MenuDao extends ServiceImpl<MenuMapper, Menu> {

    /**
     * 根据角色查询菜单
     * @param roleId
     * @return
     */
    public List<Menu> queryMenu(Long roleId){
        return baseMapper.queryMenuList(roleId);
    }
    /**
     * 查询所有菜单
     * @return
     */
    public List<Menu> queryAllMenu(){
        QueryWrapper<Menu> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("is_delete",Boolean.FALSE);
        queryWrapper.orderByDesc("sort");
        return baseMapper.selectList(queryWrapper);
    }
}